package com.lzw.breezeNovel.webApp.mapper.user;

import com.lzw.breezeNovel.model.entity.pojo.user.UserLike;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;


import java.util.List;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.mapper.user
 * @date 2025/3/24
 * @description
 */
@Mapper
@SuppressWarnings("all")
public interface UserLikeMapper {


    /**
     * 插入点赞记录
     * @param userLike
     */
    @Insert("insert into user_like(user_id,short_id,orther_id,create_time,comment_id) values(#{userId},#{shortId},#{otherId},#{createTime},#{commentId})")
    void insert(UserLike userLike);

    /**
     * 根据评论id和用户id删除
     * @param shortId
     * @param userId
     */
    @Delete("delete from user_like where comment_id = #{commentId} and user_id = #{userId}")
    void deleteByCommentIdAndUserIdAndType(Long shortId, Long userId);

    /**
     * 根据用户id分页查询
     * @param userId
     * @param start
     * @param size
     * @return
     */
    List<UserLike> selectByUserId(Long userId, Integer start, Integer size);

    /**
     * 根据点赞id删除
     * @param id
     */
    @Delete("delete from user_like where id = #{id}")
    void deleteById(Long id);


}
